<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/common.jspf" %>
<html>
<head>
<title>My JSP 'MyJsp.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

    <script type="text/javascript">
        $(function(){
            $('#updateTable').form('load',{
                tableId:row.tableId,
                tableNum:row.tableNum,
                tableName:row.tableName,
                tableSeatNum:row.tableSeatNum,
                tableWays:row.tableWays,
                tableUpdate:myformatter(new Date())
            });
            //$('#ff').form('load','dfsaf/select.action?id=row.id');	// 读取表单的URL
            $('#nn').attr('readonly',true);
        });
        var oldWin = parent.$("iframe[title='店内餐桌管理']").get(0).contentWindow;//返回ifram页面文档（window)
        var row =oldWin.$('#storeTable').datagrid("getSelected");
        //alert("获取原窗口："+row.tableId+","+row.tableNum+","+row.tableName+","+row.tableSeatNum+","+row.tableWays);
        function  save() {
            //提交表单
            $('#updateTable').form('submit',{
                url: '${proPath}/storetable/updateTable.action',
                //成功后，提示成功信息
                success:function(data){
                    alert("修改成功");
                    // 关闭本页面
                    parent.$('#win').window('close');
                    //刷新原页面
                    oldWin.$('#storeTable').datagrid("reload");
                }

            });


        }

        function myformatter(date){
            var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
            var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0"
                + (date.getMonth() + 1);
            var hor = date.getHours();
            var min = date.getMinutes();
            var sec = date.getSeconds();
            return date.getFullYear() + '-' + month + '-' + day+" "+hor+":"+min+":"+sec;
        }

    </script>


<body>
<form id="updateTable"  >
    <div>
        <label >餐桌编号:</label>
        <input class="easyui-validatebox" type="text"  id="nn" name="tableNum" data-options="required:true" />
    </div>
    <div>
        <label >餐桌名称:</label>
        <input class="easyui-validatebox" type="text" name="tableName" data-options="required:true" />
    </div>
    <div>
        <label >座位数:</label>
        <input class="easyui-validatebox" type="text" name="tableSeatNum" data-options="required:true" />
    </div>
    <div>
        <label >就餐形式:</label>
        <select id="cc" class="easyui-combobox" name="tableWays" style="width:200px;">
            <option>整桌</option>
            <option>拼桌</option>
        </select>
    </div>

    <div>
        <label >备注:</label>
        <input class="easyui-validatebox" type="text" name="name"  />
    </div>

    <div>
        <input class="easyui-validatebox" type="hidden" name="tableUpdate" />
    </div>


    <input type="button" onclick="save()" value="确定">
</form>
</body>
</html>